#ifndef LABELNAMELISTMODEL_H
#define LABELNAMELISTMODEL_H

#include <QAbstractListModel>
#include <QSet>

class LabelNameListModel : public QAbstractListModel
{
    Q_OBJECT

public:
    explicit LabelNameListModel(QObject *parent = nullptr);

    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role) const override;
    QStringList labelNames() const { return myLabelNames; }

    void tryAddName(const QString &name);
    void tryRemoveName(const QString &name);
    void tryRename(const QString &oldName, const QString &newName);

private:
    QStringList myLabelNames;
    QMap<QString, int> myNameCounts; // name -> count
};

#endif // LABELNAMELISTMODEL_H
